<!DOCTYPE html>
<html>
<!--前端界面编写
    编写者：吴茂景
-->
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>部门列表</title>
    <!-- 请勿在项目正式环境中引用该 layui.css 地址 -->
    <link href="../layui/css/layui.css" rel="stylesheet">
    <script src="../layui/layui.js" charset="UTF-8"></script>
    <script>
        let $ = layui.jquery
        $(function ($){
            search()
        })
        function search(){

            $.ajax({
                type: 'get',
                url: 'http://localhost:8080/swagger2/dept?id=0',
                dataType: 'json',
                success(data) {
                    console.log(data);
                    $('#body').html('')
                    let content = ""
                    for(i = 0; i < data.length; i++) {
                        let item = data[i];
                        content = content + `<tr><td>${item.id}</td><td>${item.deptName}</td><td>${item.deptHead}</td><td>${item.deptRank}</td><td>${item.deptHighid}</td><td><button type="button" class="layui-btn layui-btn-primary" lay-on="test-iframe-handle">编辑<span id="ID-test-iframe-mark"></span></button><button type="button" class="layui-btn layui-btn-primary" lay-on="test-iframe-handle" style="background-color:darkcyan; color: white">删除<span id="ID-test-iframe-mark"></span></button></td></tr>`
                    }
                    $('#body').html(content)
                }
            })
        }
    </script>
</head>
<body>
<!--------------------------------接入块------------------------------->
<form class="layui-form" action="http://localhost:8080/swagger2">
    <div class="layui-form-item">
        <label class="layui-form-label">部门编号</label>
        <div class="layui-input-inline">
            <input type="text" id="${id}" name="id"  lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-btn-container" >
            <button type="button" class="layui-btn" onclick="">查询</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            <button type="reset" class="layui-btn layui-btn-primary">添加</button>
        </div>
    </div>
</form>
<br>
<br>
<!-- ------------------------------------------------------------------------- -->
<!-- 请勿在项目正式环境中引用该 layui.js 地址 -->
<script src="../layui/layui.js"></script>
<!--<script type="text/html" id="barDemo">-->
<!--    <div class="layui-clear-space">-->
<!--        <button type="button" class="layui-btn layui-btn-primary" lay-on="test-iframe-handle">-->
<!--            编辑-->
<!--            <span id="ID-test-iframe-mark"></span>-->
<!--        </button>-->
<!--        <a class="layui-btn layui-btn-xs" lay-event="more">-->
<!--            删除-->
<!--        </a>-->
<!--    </div>-->
<!--</script>-->
<table class="layui-table">
    <colgroup>
        <col width="100">
        <col width="100">
        <col width="150">
        <col width="150">
        <col width="150">
        <col width="150">
        <col width="150">
    </colgroup>
    <thead>
    <tr>
        <th>部门编号</th>
        <th>部门名称</th>
        <th>部门介绍</th>
        <th>部门负责人</th>
        <th>级别</th>
        <th>上级部门</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <tbody id="body">
    </tbody>
</table>
</body>
</html>